#include<stdio.h>
#include<stdlib.h>
#define LEN sizeof(struct xssj)
struct xssj
{
	char name[30];
	int num;
	struct xssj* next;
};
struct xssj* dtlb()
{
	struct xssj *a=NULL,*b=NULL,*head=NULL;
	a=(struct xssj*)malloc(LEN);
	scanf("%s %d",&(a->name),&(a->num));
	if((a->num)!=0)
	{
		head=b=a;
	}
	while((a->num)!=0)
	{
		a=(struct xssj*)malloc(LEN);
	    scanf("%s %d",&(a->name),&(a->num));
	    b->next=a;
	    b=a;
	}
	a=b=NULL;
	return head;
}
int main()
{
	struct xssj* p=dtlb();
	while(p!=NULL)
	{
		printf("%s,%d\n",p->name,p->num);
		p=p->next;
	}
	return 0;
}
